package com.sqk.task0708;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.sqk.dxpro.utils.TProperties;

public class DxCountPvMapper extends Mapper<LongWritable, Text, Text, IntWritable>{
	
	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, IntWritable>.Context context)
			throws IOException, InterruptedException {
		// TODO Auto-generated method stub
		String[] values = value.toString().split(TProperties.getValue("fileoutsplit"));
		//用户ID        产品类型 产品ID      产品名称            品牌/区域         价格        型号     车系  手\自     行为ID
		//523047653102|house|house000144|南岗-低层-null|南岗|总价未显示|null|低层|null|002829000022000005
		
		Text tt = new Text();
		IntWritable vv = new IntWritable(1);
		//按用户ID 产品ID 分组
		tt.set(values[0].toString()+TProperties.getValue("outfilesplit")+values[2]+TProperties.getValue("outfilesplit")+values[1]);
		System.out.println("--------------key-----------"+tt);
		context.write(tt, vv);
		
	}


}

